package com.hqx.shiro.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.hqx.shiro.model.User;
import com.hqx.shiro.mapper.UserMapper;
import com.hqx.shiro.service.UserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author PH
 * @since 2019-07-25
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {


    /**
     * 通过用户姓名查找用户
     * @param username 用户名字
     * @return User
     */
    @Override
    public User findUserByName(String username) {
        User condition = new User();
        condition.setUsername(username);
        User user = selectOne(new EntityWrapper<>(condition));
        return user;
    }
}
